function isIE6or7or8() {
    return "Explorer" != BrowserDetect.browser || 8 != BrowserDetect.version && 7 != BrowserDetect.version && 6 != BrowserDetect.version ? !1 : !0;
}

var oldHtml, BrowserDetect = {
    init: function() {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser", this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version", 
        this.OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function(a) {
        var b, c, d;
        for (b = 0; b < a.length; b++) if (c = a[b].string, d = a[b].prop, this.versionSearchString = a[b].versionSearch || a[b].identity, 
        c) {
            if (-1 != c.indexOf(a[b].subString)) return a[b].identity;
        } else if (d) return a[b].identity;
    },
    searchVersion: function(a) {
        var b = a.indexOf(this.versionSearchString);
        if (-1 != b) return parseFloat(a.substring(b + this.versionSearchString.length + 1));
    },
    dataBrowser: [ {
        string: navigator.userAgent,
        subString: "Chrome",
        identity: "Chrome"
    }, {
        string: navigator.userAgent,
        subString: "OmniWeb",
        versionSearch: "OmniWeb/",
        identity: "OmniWeb"
    }, {
        string: navigator.vendor,
        subString: "Apple",
        identity: "Safari",
        versionSearch: "Version"
    }, {
        prop: window.opera,
        identity: "Opera"
    }, {
        string: navigator.vendor,
        subString: "iCab",
        identity: "iCab"
    }, {
        string: navigator.vendor,
        subString: "KDE",
        identity: "Konqueror"
    }, {
        string: navigator.userAgent,
        subString: "Firefox",
        identity: "Firefox"
    }, {
        string: navigator.vendor,
        subString: "Camino",
        identity: "Camino"
    }, {
        string: navigator.userAgent,
        subString: "Netscape",
        identity: "Netscape"
    }, {
        string: navigator.userAgent,
        subString: "MSIE",
        identity: "Explorer",
        versionSearch: "MSIE"
    }, {
        string: navigator.userAgent,
        subString: "Gecko",
        identity: "Mozilla",
        versionSearch: "rv"
    }, {
        string: navigator.userAgent,
        subString: "Mozilla",
        identity: "Netscape",
        versionSearch: "Mozilla"
    } ],
    dataOS: [ {
        string: navigator.platform,
        subString: "Win",
        identity: "Windows"
    }, {
        string: navigator.platform,
        subString: "Mac",
        identity: "Mac"
    }, {
        string: navigator.userAgent,
        subString: "iPhone",
        identity: "iPhone/iPod"
    }, {
        string: navigator.platform,
        subString: "Linux",
        identity: "Linux"
    } ]
};

BrowserDetect.init(), jQuery.fn.extend({
    listerRender: function() {
        this.each(function() {
            $(this).empty(), new jQuery.Lister(this);
        });
    },
    listerSelectValue: function(a) {
        var d, e, b = $(this).data("data"), c = a.split(",");
        if (b.fromList) for (d = 0; d < c.length; d++) e = -1, $.each(b.fromList, function(a, f) {
            f.value == c[d] && b.toList && (b.toList.push(b.fromList[a]), e = a);
        }), -1 != e && b.fromList.splice(e, 1);
        $(this).data("data", b), $(this).data("selectedNodes", b.toList), $(this).html(""), 
        new jQuery.Lister(this);
    },
    listerUnSelectValue: function(a) {
        var d, e, b = $(this).data("data"), c = a.split(",");
        if (b.toList) for (d = 0; d < c.length; d++) e = -1, $.each(b.toList, function(a, f) {
            f.value == c[d] && b.fromList && (b.fromList.push(b.toList[a]), e = a);
        }), -1 != e && b.toList.splice(e, 1);
        $(this).data("data", b), $(this).data("selectedNodes", b.toList), $(this).html(""), 
        new jQuery.Lister(this);
    },
    listerSetValue: function(a) {
        var d, e, f, b = $(this).data("data"), c = a.split(",");
        if (b.toList) {
            for (d = b.toList.length, e = 0; d > e; e++) $.each(b.toList, function(a) {
                a == e && b.fromList && b.fromList.push(b.toList[a]);
            });
            b.toList.splice(0, d);
        }
        if (b.fromList) for (e = 0; e < c.length; e++) f = -1, $.each(b.fromList, function(a, d) {
            d.value == c[e] && b.toList && (b.toList.push(b.fromList[a]), f = a);
        }), -1 != f && b.fromList.splice(f, 1);
        $(this).data("data", b), $(this).data("selectedNodes", b.toList), $(this).html(""), 
        new jQuery.Lister(this);
    },
    listerAddItem: function(a) {
        this.each(function() {
            var b = $(this).data("data");
            b.fromList.push(a), $(this).data("data", b), $(this).data("selectedNodes", b.toList), 
            $(this).html(""), new jQuery.Lister(this);
        });
    },
    listerRemoveItem: function(a) {
        this.each(function() {
            var b = $(this).data("data"), c = -1;
            $.each(b.fromList, function(b, d) {
                d.value.toString() == a && (c = b);
            }), -1 != c && b.fromList.splice(c, 1), $(this).data("data", b), $(this).data("selectedNodes", b.toList), 
            $(this).html(""), new jQuery.Lister(this);
        });
    }
}), jQuery.Lister = function(obj) {
    function sendAll(a) {
        var c, d, e, f, g, h, j, k, b = $(obj).data("data");
        b && ($(obj).attr("maxSelection") ? (a ? (c = $(obj).data("currentNum"), d = Number($(obj).attr("maxSelection")), 
        $.each(b.fromList, function() {
            if (d > c) b.toList && b.toList.push(b.fromList[0]), c++, b.fromList.splice(0, 1); else try {
                top.Dialog.alert("超出最大选择条数,已按顺序选择了最大数目的选项！");
            } catch (f) {
                alert("超出最大选择条数,已按顺序选择了最大数目的选项！");
            }
        }), $(obj).data("currentNum", c)) : b.toList && (e = b.toList.length, $.each(b.toList, function(a) {
            b.fromList && b.fromList.push(b.toList[a]);
        }), b.toList.splice(0, e), $(obj).data("currentNum", 0)), $(obj).data("data", b), 
        $(obj).data("selectedNodes", b.toList), $(obj).html(""), $(obj).removeAttr("selectedValue"), 
        new jQuery.Lister(obj)) : (a ? b.fromList && (f = b.fromList.length, $.each(b.fromList, function(a) {
            b.toList && b.toList.push(b.fromList[a]);
        }), b.fromList.splice(0, f)) : b.toList && (g = b.toList.length, $.each(b.toList, function(a) {
            b.fromList && b.fromList.push(b.toList[a]);
        }), b.toList.splice(0, g)), a ? (h = mainUL, j = "&#9668;") : (h = otherUL, j = "&#9658;"), 
        $(h).children("li[el]").each(function() {
            var b = $(this), c = $(b).children("span");
            $(this).parent("ul").attr("id"), $(c).each(function() {
                $(this).html(j);
            }), a ? $(otherUL).prepend(b) : $(mainUL).prepend(b);
        }), $(h).empty(), $(obj).data("data", b), $(obj).data("selectedNodes", b.toList), 
        k = getValue(), $(obj).attr("relValue", k), $(obj).attr("relText", getValue("title")), 
        $hidden.val(k)), $(obj).trigger("itemClick"));
    }
    function getValue(a) {
        var b = [];
        return $(otherUL).children("li[el]").each(function() {
            var c;
            c = a ? $(this).attr(a) : $.trim($(this).attr("el")), "" != c && null != c && b.push($.trim(c));
        }), b.toString().replace(/\s+/g, "");
    }
    function sendTo() {
        var f, g, h, i, k, l, m, b = $(this), c = $(b).children("span"), d = $(this).parent("ul").attr("flag"), e = $(obj).data("data");
        if (e) {
            if (f = $(obj).data("currentNum"), "to" == d) g = $('<div class="itemMinEffect"></div>'), 
            g.css({
                width: b.width(),
                height: b.height(),
                left: currentMouseX + "px",
                top: currentMouseY - 10 + "px",
                opacity: .1
            }).animate({
                width: 0,
                height: 0,
                left: currentMouseX - 300 - b.width() + "px",
                top: currentMouseY - 10 + "px",
                opacity: 0
            }, 400, function() {
                g.remove();
            }), $("body").append(g), mainUL.prepend(b), $(c).removeClass("right").addClass("left").html("&#9658;"), 
            e.toList && (h = -1, $.each(e.toList, function(a, c) {
                c.value == b.attr("el") && e.fromList && (e.fromList.push(e.toList[a]), h = a);
            }), -1 != h && e.toList.splice(h, 1)), f--, $(obj).data("currentNum", f); else {
                if ($(obj).attr("maxSelection") && (i = Number($(obj).attr("maxSelection")), f == i)) {
                    try {
                        top.Dialog.alert(uncompile(quiLanguage.lister.maxNumMessage));
                    } catch (j) {
                        alert(uncompile(quiLanguage.lister.maxNumMessage));
                    }
                    return;
                }
                k = $('<div class="itemMinEffect"></div>'), k.css({
                    width: b.width(),
                    height: b.height(),
                    left: currentMouseX - 100 + "px",
                    top: currentMouseY - 10 + "px",
                    opacity: .1
                }).animate({
                    width: 0,
                    height: 0,
                    left: currentMouseX + 300 + b.width() + "px",
                    top: currentMouseY - 10 + "px",
                    opacity: 0
                }, 400, function() {
                    k.remove();
                }), $("body").append(k), otherUL.prepend(b), $(c).removeClass("left").addClass("right").html("&#9668;"), 
                e.fromList && (l = -1, $.each(e.fromList, function(a, c) {
                    c.value == b.attr("el") && e.toList && (e.toList.push(e.fromList[a]), l = a);
                }), -1 != l && e.fromList.splice(l, 1)), f++, $(obj).data("currentNum", f);
            }
            $(obj).data("data", e), $(obj).data("selectedNodes", e.toList), $(this).removeClass("hover").removeClass("listerHover"), 
            m = getValue(), $(obj).attr("relValue", m), $(obj).attr("relText", getValue("title")), 
            $hidden.val(m), $(obj).trigger("itemClick");
        }
    }
    function divNester() {
        var c, d, e, f, g, h, i, a = $("<div></div>"), b = $("<div></div>");
        null != $(obj).attr("fromTitle") ? a.html($(obj).attr("fromTitle")) : a.html(uncompile(quiLanguage.lister.fromTitle)), 
        null != $(obj).attr("toTitle") ? b.html($(obj).attr("toTitle")) : b.html(uncompile(quiLanguage.lister.toTitle)), 
        c = $.create("div").addClass("listerLinksLeft").append(a).append(mainUL), d = $.create("div").addClass("listerLinksRight").append(b).append(otherUL), 
        $(obj).attr("listerWidth") ? (c.width(Number($(obj).attr("listerWidth"))), d.width(Number($(obj).attr("listerWidth")))) : (c.width(200), 
        d.width(200)), e = $('<div class="listBtn"></div>'), f = $('<input type="button" value="' + uncompile(quiLanguage.lister.selectAllBtnText) + '" class="button"/>'), 
        f.bind("click", function() {
            sendAll(!0);
        }), e.append(f), e.append("<br/><br/>"), g = $('<input type="button" value="' + uncompile(quiLanguage.lister.deSelectAllBtnText) + '" class="button">'), 
        g.bind("click", function() {
            sendAll(!1);
        }), e.append(g), h = $('<table cellspacing="0" cellpadding="0" style="border-style:none;"><tr><td class="ali01" style="border-style:none;padding:0;margin:0;"></td><td class="ali02" style="border-style:none;padding-left:5px;padding-right:5px;margin:0;"></td><td class="ali01" style="border-style:none;padding:0;margin:0;"></td></tr></table>'), 
        h.find("td").eq(0).append(c), h.find("td").eq(1).append(e), h.find("td").eq(2).append(d), 
        $(outerDiv).append(h), $(outerDiv).width(h.width()), 0 == enabled && (f.attr("disabled", "true"), 
        g.attr("disabled", "true"), $(outerDiv).mask(uncompile(quiLanguage.lister.disabledMessage), 0, !1, "#ffffff")), 
        f.buttonInputRender(), g.buttonInputRender(), $(outerDiv).append($hidden), i = getValue(), 
        $(obj).attr("relValue", i), $(obj).attr("relText", getValue("title")), $hidden.val(i), 
        $(obj).attr("finished", "true");
    }
    function scrollA() {
        var c, a = $(this).parent("div").children("ul"), b = $(this).text();
        $(a).scrollTop(0), c = $(a).children("li[tx=" + b + "]").offset().top - $(a).offset().top, 
        $(a).animate({
            scrollTop: c
        }, 500);
    }
    function setupHidden() {
        var a = $('<input type="hidden">');
        return null != $(obj).attr("name") && a.attr("name", $(obj).attr("name")), a;
    }
    function selectedValueHandler(a, b) {
        var c, d, e, f;
        if (a) {
            if (c = b.split(","), $(obj).data("currentNum", c.length), a.toList) {
                for (d = a.toList.length, e = 0; d > e; e++) $.each(a.toList, function(b) {
                    b == e && a.fromList && a.fromList.push(a.toList[b]);
                });
                a.toList.splice(0, d);
            }
            if (a.fromList) for (e = 0; e < c.length; e++) f = -1, $.each(a.fromList, function(b, d) {
                d.value == c[e] && a.toList && (a.toList.push(a.fromList[b]), f = b);
            }), -1 != f && a.fromList.splice(f, 1);
            return a;
        }
    }
    function createOptions(a) {
        a && (a.fromList && $.each(a.fromList, function(a, b) {
            var c = $.create("span").addClass("left").html("&#9658;"), d = $.create("li");
            d.html(b.key), d.attr("title", b.key), d.attr("el", b.value), d.bind("click", sendTo).tclass("listerHover").prepend(c).bind("mouseover", function() {
                $(this).addClass("hover");
            }).bind("mouseout", function() {
                $(this).removeClass("hover");
            }), mainUL.append(d);
        }), a.toList && $.each(a.toList, function(a, b) {
            var c = $.create("span").addClass("left").html("&#9668;"), d = $.create("li");
            d.html(b.key), d.attr("title", b.key), d.attr("el", b.value), d.bind("click", sendTo).tclass("listerHover").prepend(c).bind("mouseover", function() {
                $(this).addClass("hover");
            }).bind("mouseout", function() {
                $(this).removeClass("hover");
            }), otherUL.append(d);
        }), divNester());
    }
    var $hidden, outerDiv, mainUL, otherUL, enabled, paramsStr, paramsObj, selectedValue, dataObj, urlStr, dataStr, dataObj2, dataType;
    if ($.sortA = [], $.sortB = [], $.ie = isIE6or7or8(), $.create = function(a) {
        return $(document.createElement(a));
    }, $.fn.fillLister = function() {
        $(mainUL).scrollTop(0).children("li").each(function() {
            if (!$(this).children("span").hasClass("left")) {
                var a = $.create("span").addClass("left").html("&#9658;");
                $(this).bind("click", sendTo).prepend(a);
            }
        });
    }, $.fn.tclass = function(a) {
        return $(this).bind("mouseover", function() {
            $(this).addClass(a);
        }), $(this).bind("mouseout", function() {
            $(this).removeClass(a);
        }), this;
    }, $.fn.sendItem = function(a, b) {
        var c = a, d = $(c).children("span"), e = a.parent("ul").attr("id");
        b ? e == el || ($(otherUL).prepend(c), $(d).removeClass("left").addClass("right").html("&#9668;")) : e == el && ($(mainUL).prepend(c), 
        $(d).removeClass("right").addClass("left").html("&#9658;")), a.removeClass("hover").removeClass("listerHover");
    }, $.fn.sortLists = function(a) {
        var c, d, e, b = $(a);
        $.ie || ($(b).children("li[tx]").each(function() {
            $(this).remove();
        }), $(b).parent("div").children("a").each(function() {
            $(this).remove();
        }), $(b).parent("div").children("span").each(function() {
            $(this).remove();
        })), c = b.children("li").get(), c.sort(function(a, b) {
            var c = $(a).text().toUpperCase(), d = $(b).text().toUpperCase();
            return d > c ? -1 : c > d ? 1 : 0;
        }), $.ie || (d = "", e = ""), $.each(c, function(a, c) {
            $.ie || (e = $(c).text().substring(1, 2), e.toUpperCase() != d.toUpperCase() && ($(b).append($.create("li").text(e).attr("tx", e.toUpperCase()).addClass("liTitles")), 
            $(b).before($.create("a").bind("click", scrollA).text(e.toUpperCase())).before($.create("span").text(" | ")))), 
            b.append(c), $.ie || (d = e);
        });
    }, $hidden = setupHidden(), outerDiv = $(obj), mainUL = $.create("ul").addClass("lister").attr("flag", "from"), 
    otherUL = $.create("ul").addClass("lister").attr("flag", "to"), $(obj).attr("listerHeight") ? (mainUL.height(Number($(obj).attr("listerHeight"))), 
    otherUL.height(Number($(obj).attr("listerHeight")))) : (mainUL.height(200), otherUL.height(200)), 
    $(obj).data("currentNum", 0), enabled = !0, $(obj).attr("disabled") && (enabled = "false" == $(obj).attr("disabled") || 0 == $(obj).attr("disabled") ? !0 : !1), 
    paramsStr = $(obj).attr("params")) try {
        paramsObj = JSON.parse(paramsStr);
    } catch (e) {
        paramsObj = [], alert(uncompile(quiLanguage.lister.paramErrorMessage));
    } else paramsObj = [];
    if (selectedValue = "-1", null != $(obj).attr("selectedValue") && (selectedValue = $(obj).attr("selectedValue")), 
    dataObj = "", urlStr = $(obj).attr("url"), dataStr = $(obj).attr("data"), dataObj2 = $(obj).data("data")) $(obj).data("currentNum", dataObj2.toList.length), 
    "-1" == selectedValue ? createOptions(dataObj2) : createOptions(selectedValueHandler(dataObj2, selectedValue)); else if (dataStr) {
        try {
            dataObj = JSON.parse(dataStr);
        } catch (e) {
            dataObj = "", alert(uncompile(quiLanguage.lister.dataErrorMessage));
        }
        "-1" == selectedValue ? createOptions(dataObj) : createOptions(selectedValueHandler(dataObj, selectedValue)), 
        $(obj).data("data", dataObj), $(obj).data("selectedNodes", dataObj.toList);
    } else urlStr && (dataType = "json", $(obj).attr("dataType") && (dataType = $(obj).attr("dataType")), 
    $.ajax({
        url: $(obj).attr("url"),
        dataType: dataType,
        data: paramsObj,
        error: function() {
            alert(uncompile(quiLanguage.lister.urlErrorMessage));
        },
        success: function(data) {
            var myData;
            myData = "text" == dataType ? eval("(" + data + ")") : data, $(obj).data("data", myData), 
            $(obj).data("selectedNodes", myData.toList), "-1" == selectedValue ? createOptions(myData) : createOptions(selectedValueHandler(myData, selectedValue));
        }
    }));
    return this;
};